package com.bilibili.juc.me;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class StringDemo {
    public static void main(String[] args) {
        //StringBuilder
        String str = "abcdef";
        System.out.println("original==>>" + str);
        char[] chars = str.toCharArray();
        char c ;
        for (int i = 0,j=chars.length-1; i < j; i++,j--) {
            c = chars[i];
            chars[i] = chars[j];
            chars[j]=c;
        }
        System.out.println("result=> " + new String(chars));
        BigDecimal rs = BigDecimal.valueOf(5.0).divide(BigDecimal.valueOf(3.0), 2, RoundingMode.HALF_UP);
//        BigDecimal rs = BigDecimal.valueOf(5.0).divide(BigDecimal.valueOf(3.0)); //Exception in thread "main" java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
        System.out.println(rs);
    }
}
